<!--
 * @Author: WangGuojian 1085844536@qq.com
 * @Date: 2023-09-08 18:34:44
 * @LastEditTime: 2023-09-22 19:48:06
 * @LastEditors: WangGuojian 1085844536@qq.com
 * @FilePath: \htmld:\Developer\WGJ\VSCode_WorkSpace\Web\vue\vue_test\src\components\Student.vue
 * @Description:
-->
<template>
    <div>
        <div class="student">
            <h2>学生姓名：{{ name }}</h2>
            <h2>学生性别：{{ sex }}</h2>
            <button @click="sendStudentName">把学生名给App</button>
        </div>
    </div>
</template>

<script>
export default {
    name: 'Student',
    data() {
        return {
            name: '张三',
            sex: '男',
        };
    },
    methods: {
        sendStudentName() {
            // 触发Student实例身上的atguigu事件
            this.$emit('atguigu', this.name, 666, 888, 900);
        },
    },
};
</script>

<style lang="less">
.student {
    background-color: pink;
    padding: 5px;
    margin-top: 30px;
}
</style>
